const MIN_INCOME_LIST = [
	{
		name: '5千以上',
		value:  5000,
	},
	{
		name: '1万以上',
		value: 10000,
	},
	{
		name: '2万以上',
		value: 20000,
	},
	{
		name: '3万以上',
		value: 30000,
	},
	{
		name: '5万以上',
		value: 50000,
	},
	{
		name: '10万以上',
		max: 100000,
	},
]


export const getMinIncomeList = ({ hasEmpty = true } = {}) => {
  const incomeList = [...MIN_INCOME_LIST];
  if (hasEmpty) {
    incomeList.unshift({
			name: '不限',
			value: null
		})
  }

  return incomeList
}

export const getMinIncomeValueByIndex = ({ hasEmpty = true, index } = {}) => {
  const incomeList = getMinIncomeList({ hasEmpty });

	const value = incomeList[index];
	return value || {}
}

const minIncomeValueToText = (value) => {
	if(value / 10000 >= 1) {
		return `${parseInt(value/10000)}万`
	}

	return `${parseInt(value/1000)}千`
}

export const minIncomeToText = (value) => {
	if (!value) {
		return ''
	}

	return `${minIncomeValueToText(value)}以上`
}